package com.example.webmock.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author scout.du
 * @date 2025/10/22 15:01
 **/
@RestController
@RequestMapping
public class HelloController {

    @GetMapping("/hello")
    public String hello(){
        return "hello";
    }

    @GetMapping("/profile/by/ownerVins")
    @ResponseBody
    public JSONArray getProfile(){

        String response = """
                [
                    {
                        "ciamId": "ervdlkes4c4kjzvx",
                        "porscheId": "WP1AC2XA7PL040005@porsche.ibn",
                        "acceptedDataPrivacyDate": "2023-04-04T01:52:53Z",
                        "acceptedDataPrivacyVersion": "PorscheConnectDPG/CN/zh_CN/v1.1",
                        "acceptedTermsAndConditionsDate": "2023-04-04T01:52:53Z",
                        "acceptedTermsAndConditionsVersion": "PorscheConnectTAC/CN/zh_CN/v1.0",
                        "preferredDealerId": "0c0c4930-a014-11e5-94f6-d8913b26e8a6",
                        "dealers": [
                            "0c0c4930-a014-11e5-94f6-d8913b26e8a6"
                        ],
                        "firstName": "808",
                        "identityVerificationState": "UNVERIFIED",
                        "lastName": "porsche",
                        "language": "zh-cn",
                        "localizedFirstName": "808",
                        "localizedLastName": "porsche",
                        "mbbUid": null,
                        "mbbNames": null,
                        "salutation": "0001",
                        "salutationValue": "先生",
                        "status": "CONFIRMED",
                        "preferredCountry": "CN",
                        "addresses": [
                            {
                                "addressId": "ovve6jvbgm2w4oa6",
                                "ciamId": "ervdlkes4c4kjzvx",
                                "usage": "work",
                                "street1": "1215 Dongfang Rd",
                                "district": null,
                                "city": "Shanghai",
                                "postalCode": "200120",
                                "postalCodeRegion": "020",
                                "postalCodeRegionValue": "上海市",
                                "country": "CN",
                                "isStandard": true,
                                "isExpressBuyAddress": false,
                                "isBillingAddress": false,
                                "isDeliveryAddress": false,
                                "format": null
                            }
                        ],
                        "emails": [
                            {
                                "emailId": "yyso1bvrf0byhquj",
                                "email": "WP1AC2XA7PL040005@porsche.ibn",
                                "isVerified": true,
                                "isPending": false,
                                "isStandard": true,
                                "usage": "work"
                            }
                        ],
                        "mobiles": [
                            {
                                "mobileId": "4n5frpet9asgmvan",
                                "number": "+8615738518183",
                                "isVerified": true,
                                "isPending": false,
                                "isStandard": true,
                                "usage": "work"
                            }
                        ],
                        "phones": [],
                        "vehicles": [
                            {
                                "vin": "WP1AC2XA7PL040005",
                                "state": "N",
                                "ownershipType": "owner",
                                "invitedBy": "0c0c4930-a014-11e5-94f6-d8913b26e8a6",
                                "pcc": true,
                                "confirmed": true,
                                "validFrom": "2023-04-04T01:50:21Z"
                            }
                        ]
                    }
                ]
                """;
        JSONArray jsonArray = JSON.parseArray(response);
        return jsonArray;
    }

}
